//
//  RentInforCell.m
//  RENTVISITOR
//
//  Created by wonder on 2017/10/26.
//  Copyright © 2017年 UNN. All rights reserved.
//

#import "RentInforCell.h"
#import "RentVieitor.h"
@implementation RentInforCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellEditingStyleNone;
        [self setUI];
    }
    return self;
}
- (void)setUI
{
    if (!_Mainlable) {
        _Mainlable = [UILabel new];
        _Mainlable.text = @"uilable";
        _Mainlable.font = [UIFont systemFontOfSize:15];
        _Mainlable.textAlignment = NSTextAlignmentLeft;
        _Mainlable.textColor = [UIColor colorWithHexString:@"#101010"];
        [self addSubview:_Mainlable];
        [_Mainlable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(30*ScaleWidth);
            make.top.mas_equalTo(30*ScaleHeight);
            make.height.mas_equalTo(30*ScaleHeight);
        }];
    }
    self.locationimageView = [[UIImageView alloc]init];
    [self addSubview:self.locationimageView];
    self.locationimageView.image = [UIImage imageNamed:@"位置-拷贝"];
    [self.locationimageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.Mainlable.mas_left);
        make.top.mas_equalTo(self.Mainlable.mas_bottom).mas_offset(25*ScaleHeight);
        make.size.mas_equalTo(CGSizeMake(20*ScaleWidth,22*ScaleHeight));
    }];
    self.locationLable  = [[UILabel alloc]init];
    self.locationLable.text = @"uilable";
    self.locationLable.font = [UIFont systemFontOfSize:10];
    self.locationLable.textAlignment = NSTextAlignmentLeft;
    self.locationLable.textColor = [UIColor colorWithHexString:@"#333333"];
    [self addSubview:self.locationLable];
    [self.locationLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.locationimageView.mas_right).mas_offset(6*ScaleWidth);
        make.top.mas_equalTo(self.locationimageView.mas_top);
        make.height.mas_equalTo(30*ScaleHeight);
    }];
    self.houseimageView = [[UIImageView alloc]init];
    [self addSubview:self.houseimageView];
    self.houseimageView.image = [UIImage imageNamed:@"概况-拷贝"];
    [self.houseimageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.locationimageView.mas_left);
        make.top.mas_equalTo(self.locationimageView.mas_bottom).mas_offset(20*ScaleHeight);
        make.size.mas_equalTo(CGSizeMake(20*ScaleWidth,22*ScaleHeight));
    }];
    self.araeLable  = [[UILabel alloc]init];
    self.araeLable.text = @"uilable";
    self.araeLable.font = [UIFont systemFontOfSize:10];
    self.araeLable.textAlignment = NSTextAlignmentLeft;
    self.araeLable.textColor = [UIColor colorWithHexString:@"#333333"];
    [self addSubview:self.araeLable];
    [self.locationLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.houseimageView.mas_right).mas_offset(6*ScaleWidth);
        make.top.mas_equalTo(self.houseimageView.mas_top);
        make.height.mas_equalTo(30*ScaleHeight);
    }];
    self.priceLable = [[UILabel alloc]init];
    self.priceLable.text = @"uilable";
    self.priceLable.font = [UIFont systemFontOfSize:10];
    self.priceLable.textAlignment = NSTextAlignmentLeft;
    self.priceLable.textColor = [UIColor colorWithHexString:@"#e52323"];
    [self addSubview:self.priceLable];
    [self.priceLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self).mas_offset(-35*ScaleWidth);
        make.bottom.mas_equalTo(self).mas_offset(-30*ScaleHeight);
        make.height.mas_equalTo(36*ScaleHeight);
    }];

}
- (void)setModel:(QiuZuModel *)model
{
    _model = model;
//    _model.fang_bedroom
    NSString *fangbedroom = [NSString stringWithFormat:@"%@",_model.fang_bedroom[0]];
    self.Mainlable.text = _model.title;
    self.locationLable.text = [NSString stringWithFormat:@"期望区域:%@ %@",_model.district_name,_model.region_name];
    self.araeLable.text   = [NSString stringWithFormat:@"住宅求组:%@|期望面积:%@-%@㎡",fangbedroom,_model.fang_bedroom,_model.square_start,_model.square_end];
    self.priceLable.text  = [NSString stringWithFormat:@"%@-%@元/月",_model.rent_start,_model.rent_end];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
